<!DOCTYPE HTML>
<html  lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-banner-add">
			<div class="form-group">	
				<label class="col-sm-3 control-label">图片地址：</label>
				<div class="col-sm-8">
					<input type="hidden"  class="form-control" id="url"  name="url" value="" >
					<img src="/profile/upload/20200929/1601346283630_37.png" width="100px" id="imgUrl">
					<button type="button" class="imgBtn">选择图片</button>
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">分类专区/珠宝/秒杀：</label>
				<div class="col-sm-8">
					<input id="type" name="type" class="form-control" type="text">
				</div>
			</div>
		</form>
	</div>
    <div th:include="include::footer"></div>
	<link type="text/css" rel="stylesheet" href="/js/plugins/uploadifive/uploadifive.css" />
	<script type="text/javascript" src="/js/plugins/uploadifive/jquery.uploadifive.min.js"></script>
    <script type="text/javascript">
		var prefix = ctx + "system/banner"
		$("#form-banner-add").validate({
			rules:{
				xxxx:{
					required:true,
				},
			}
		});
		
		function submitHandler() {
	        if ($.validate.form()) {
	            $.operate.save(prefix + "/add", $('#form-banner-add').serialize());
	        }
	    }
        $(function () {
            //图片上传
            $('.imgBtn').uploadifive({
                'auto' : true,
                'uploadScript' : '/api/goods/multipart',
                buttonClass:"btn-link",
                'method' :"post",
                'fileObjName' : 'mediaFile',
                'buttonText' : '浏览...',
                'fileType' : 'image',
                'multi' : false,
                'fileSizeLimit'   : 5242880,
                'removeCompleted' : true, //取消上传完成提示
                'uploadLimit' : 10,
                'queueSizeLimit'  : 10,
                'overrideEvents': ['onDialogClose', 'onError'],    //onDialogClose 取消自带的错误提示
                'onUploadComplete' : function(file, data) {
                    log.log(data)
                    $("#imgUrl").attr("src" , data);
                    log.log(data)
                    $("#url").val(data);

                },
                onFallback : function() {
                    $.messager.alert("温馨提示","该浏览器无法使用!");
                }
            });
        })
	</script>
</body>
</html>
